package com.jk.smartelderlycare.controller;

import com.jk.smartelderlycare.dto.SysRole;
import com.jk.smartelderlycare.dto.SysUser;
import com.jk.smartelderlycare.interfaces.SysUserServiceApi;
import com.jk.smartelderlycare.pojo.PagedResponse;
import com.jk.smartelderlycare.service.SysUserService;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author hhk
 * @version 1.0
 * @ClassName SysUserController
 * @program: smart-elderly-care
 * @description: TODO
 * @date 2024/11/5 18:54
 */
@Slf4j
@RestController
public class SysUserController implements SysUserServiceApi {
    @Autowired
    private SysUserService sysUserService;

    /**
     * @description: 员工列表后端分页查询
     * @param: [sysUser, pageNum, pageSize]
     * @return: com.jk.smartelderlycare.pojo.PagedResponse<com.jk.smartelderlycare.dto.SysUser>
     * @author hhk
     * @date: 2024/11/5 18:56
     */
    @Override
    public PagedResponse<SysUser> findSysUserPaginationList(SysUser sysUser, Integer pageNum, Integer pageSize) {
        return sysUserService.findSysUserPaginationList(sysUser, pageNum, pageSize);
    }

    /**
     * @description: 新增员工列表
     * @param: [sysUser]
     * @return: void
     * @author hhk
     * @date: 2024/11/5 18:57
     */
    @Override
    public void addSysUser(SysUser sysUser) {
        sysUserService.addSysUser(sysUser);
    }

    /**
     * @description: 根据id删除一条数据
     * @param: [userId]
     * @return: void
     * @author hhk
     * @date: 2024/11/5 18:57
     */
    @Override
    public void deleteSysUserByUserId(Long userId) {
        sysUserService.deleteSysUserByUserId(userId);
    }

    /**
     * @description: 根据id回显一条数据
     * @param: [userId]
     * @return: com.jk.smartelderlycare.dto.SysUser
     * @author hhk
     * @date: 2024/11/5 18:57
     */
    @Override
    public SysUser findSysUserByUserId(Long userId) {
        return sysUserService.findSysUserByUserId(userId);
    }

    /**
     * @description: 修改员工列表
     * @param: [sysUser]
     * @return: void
     * @author hhk
     * @date: 2024/11/5 18:58
     */
    @Override
    public void updateSysUser(SysUser sysUser) {
        sysUserService.updateSysUser(sysUser);
    }
    /** 
     * @description: 登录
     * @param: [username]
     * @return: com.jk.smartelderlycare.dto.SysUser
     * @author hhk
     * @date: 2024/11/6 16:06
     */ 
    @Override
    public SysUser findSysUserByUserName(String username) {
        return sysUserService.findSysUserByUserName(username);
    }
    /**
     * @description: 状态修改
     * @param: [sysUser]
     * @return: void
     * @author hhk
     * @date: 2024/11/6 20:22
     */
    @Override
    public void updateStatusById(SysUser sysUser) {
        sysUserService.updateStatusById(sysUser);
    }
    /**
     * @description: 角色动态下拉列表查询
     * @param: [sysRole]
     * @return: java.util.List<com.jk.smartelderlycare.dto.SysRole>
     * @author hhk
     * @date: 2024/11/6 20:25
     */
    @Override
    public List<SysRole> findSysRoleList() {
        return sysUserService.findSysRoleList();
    }
    /**
     * @description: 根据当前登陆人id查询
     * @param: [userId]
     * @return: com.jk.smartelderlycare.dto.SysUser
     * @author hhk
     * @date: 2024/11/11 10:08
     */
    @Override
    public List<SysUser> getSysUserByUsername(SysUser sysUser) {
        return sysUserService.getSysUserByUsername(sysUser);
    }
    /** 
     * @description: 修改密码
     * @param: [sysUser]
     * @return: void
     * @author hhk
     * @date: 2024/11/11 11:17
     */ 
    @Override
    public void upSysUserByPassWord(SysUser sysUser) {
        sysUserService.upSysUserByPassWord(sysUser);
    }

    /** 
     * @description: 用户表单表修改
     * @param: [sysUser]
     * @return: void
     * @author hhk
     * @date: 2024/11/12 14:26
     */ 
    @Override
    public void uptSysUser(SysUser sysUser) {
        sysUserService.uptSysUser(sysUser);
    }

    /**
     * @description: 角色新增
     * @param: [sysRole]
     * @return: void
     * @author hhk
     * @date: 2024/11/12 20:39
     */
    @Override
    public void addSysRole(SysRole sysRole) {
        sysUserService.addSysRole(sysRole);
    }

}
